﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace MatchResults.ViewModel
{
    public class LiveMatchResultViewModel : ViewModelBase
    {


        private int m_MatchId;

        private int m_Statusid;
        private string m_Lig;
        private string m_Takimlar;
        private string m_Scorecurrentaway;
        private string m_Scorecurrenthome;
        private string m_Scorehalfhome;
        private string m_Scorehalfaway;
        private string m_Minute;
        private string m_Matchstart;
        private string m_Secondhalfstart;
        private string m_LeftGole1;
        private string m_RightGole1;
        private string m_LeftGole2;
        private string m_RightGole2;
        private string m_Iy;
        private string m_Ms;
        private string m_BackgroundColor;

        #region [ Propert(ies) ]

        public string BackgroundColor
        {
            get { return m_BackgroundColor; }
            set
            {
                if (value != m_BackgroundColor)
                {

                    m_BackgroundColor = value;
                    NotifyPropertyChanged("BackgroundColor");
                }
            }
        }

        public int MatchId
        {
            get { return m_MatchId; }
            set
            {
                if (value != m_MatchId)
                {

                    m_MatchId = value;
                    NotifyPropertyChanged("MatchId");
                }
            }
        }

        public string LeftGole1
        {
            get { return m_LeftGole1; }
            set
            {
                if (value != m_LeftGole1)
                {
                    m_LeftGole1 = value;
                    NotifyPropertyChanged("LeftGole1");
                }
            }
        }

        public string RightGole1
        {
            get { return m_RightGole1; }
            set
            {
                if (value != m_RightGole1)
                {
                    m_RightGole1 = value;
                    NotifyPropertyChanged("RightGole1");
                }
            }
        }

        public string LeftGole2
        {
            get { return m_LeftGole2; }
            set
            {
                if (value != m_LeftGole2)
                {
                    m_LeftGole2 = value;
                    NotifyPropertyChanged("LeftGole2");
                }
            }
        }

        public string RightGole2
        {
            get { return m_RightGole2; }
            set
            {
                if (value != m_RightGole2)
                {
                    m_RightGole2 = value;
                    NotifyPropertyChanged("RightGole2");
                }
            }
        }



        public int Statusid
        {
            get
            {
                return m_Statusid;
            }
            set
            {
                if (value != m_Statusid)
                {
                    m_Statusid = value;
                    NotifyPropertyChanged("Statusid");
                }
            }
        }

        public String Takimlar
        {
            get
            {
                return m_Takimlar;
            }
            set
            {
                if (value != m_Takimlar)
                {
                    m_Takimlar = value;
                    NotifyPropertyChanged("Takimlar");
                }
            }
        }

        public String Lig
        {
            get
            {
                return m_Lig;
            }
            set
            {
                if (value != m_Lig)
                {
                    m_Lig = value;
                    NotifyPropertyChanged("Lig");
                }
            }
        }

        public string Scorehalfhome
        {
            get
            {
                return m_Scorehalfhome;
            }
            set
            {
                if (value != m_Scorehalfhome)
                {
                    m_Scorehalfhome = value;
                    NotifyPropertyChanged("Scorehalfhome");
                }
            }
        }

        public string Scorehalfaway
        {
            get
            {
                return m_Scorehalfaway;
            }
            set
            {
                if (value != m_Scorehalfaway)
                {
                    m_Scorehalfaway = value;
                    NotifyPropertyChanged("Scorehalfaway");
                }
            }
        }

        public string Scorecurrenthome
        {
            get
            {
                return m_Scorecurrenthome;
            }
            set
            {
                if (value != m_Scorecurrenthome)
                {
                    if (!string.IsNullOrEmpty(m_Scorecurrenthome))
                    {
                        BackgroundColor = "Red";
                        if (Statusid == 2)
                        {
                            LeftGole1 = "/MatchResults;component/images/ball.png";
                        }
                        else
                        {
                            LeftGole2 = "/MatchResults;component/images/ball.png";

                        }
                    }
                    m_Scorecurrenthome = value;
                    NotifyPropertyChanged("Scorecurrenthome");
                    Iy = Ms = m_Scorecurrenthome + "-" + m_Scorecurrentaway;
                }
                else
                {
                    BackgroundColor = "Transparent";
                    LeftGole1 = "";
                    LeftGole2 = "";
                }
            }
        }

        public string Scorecurrentaway
        {
            get
            {
                return m_Scorecurrentaway;
            }
            set
            {
                if (value != m_Scorecurrentaway)
                {
                    if (!string.IsNullOrEmpty(m_Scorecurrentaway))
                    {
                        BackgroundColor = "Red";
                        if (Statusid == 2)
                        {
                            RightGole1 = "/MatchResults;component/images/ball.png";
                        }
                        else
                        {
                            RightGole2 = "/MatchResults;component/images/ball.png";
                        }
                    }
                    m_Scorecurrentaway = value;
                    NotifyPropertyChanged("Scorecurrentaway");

                    Iy = Ms = m_Scorecurrenthome + "-" + m_Scorecurrentaway;
                }
                else
                {
                    if (LeftGole1 == string.Empty &&  LeftGole2 == string.Empty )
                    {
                        BackgroundColor = "Transparent";
                    }
                    RightGole1 = "";
                    RightGole2 = "";
                }
            }
        }

        public String Matchstart
        {
            get
            {
                return m_Matchstart;
            }
            set
            {
                if (value != m_Matchstart)
                {
                    m_Matchstart = value;
                    NotifyPropertyChanged("Matchstart");
                }
            }
        }

        public String Secondhalfstart
        {
            get
            {
                return m_Secondhalfstart;
            }
            set
            {
                if (value != m_Secondhalfstart)
                {
                    m_Secondhalfstart = value;
                    NotifyPropertyChanged("Secondhalfstart");
                }
            }
        }

        public string Minute
        {
            get
            {
                return m_Minute;
            }
            set
            {
                if (value != m_Minute)
                {
                    m_Minute = value;
                    NotifyPropertyChanged("Minute");
                }
            }
        }



        public string Iy
        {
            get { return m_Iy; }
            set
            {
                if (value != m_Iy)
                {
                    m_Iy = value;
                    NotifyPropertyChanged("Iy");
                }
            }
        }

        public string Ms
        {
            get { return m_Ms; }
            set
            {
                if (value != m_Ms)
                {
                    m_Ms = value;
                    NotifyPropertyChanged("Ms");
                }
            }
        }

        #endregion
    }
}
